unit Test_MyMsg_UsingUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, mymsgs, Test_MyMsg_UsingUnit2;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
        msg:Tmymsg;
        f2:TForm2;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
    f2:=TForm2.Create(nil);
    msg:=Tmymsg.GetInstance;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
    msg.ReleaseInstance;
    f2.Free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
    msg.ShowMyMsg('Test!');
end;

end.
